package com.zxl.flyweight;

import java.util.Hashtable;
/**
 * ��Ԫ��������������������flyweight������Ҫ����ȷ������Ĺ���flyweight�����û�����һ��flyweightʱ��
 * Flyweight�����ṩһ���Ѵ�����ʵ����ߴ���һ��
 * @author zxl
 * 2016��8��17��
 */
public class FlyweightFactory {
	private Hashtable<String,Flyweight> flyweightMap = new Hashtable<String, Flyweight>();
	/**
	 * ��ʼ������ʱ����������ʵ��
	 */
	public FlyweightFactory(){
		flyweightMap.put("X", new ConcreteFlyweight());
		flyweightMap.put("Y", new ConcreteFlyweight());
		flyweightMap.put("Z", new ConcreteFlyweight());
	}
	/**
	 * 
	 * ��ݿͻ����󣬻������ɵ�ʵ��
	 * zxl
	 * 2016��8��18�� ����9:14:09
	 * @param key
	 * @return
	 * Flyweight
	 */
	public Flyweight getFlyweight(String key){
		return flyweightMap.get(key);
	}
}
